package ssm.testSpring;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import ssm.myfactorybean.PersonFactoryBean;

public class StartDemo {

    public static void main(String[] args){
//        ClassPathResource res = new ClassPathResource("spring/applicationContext.xml");
//        DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
//        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory);
//        reader.loadBeanDefinitions(res);
        ApplicationContext app= new FileSystemXmlApplicationContext("D:\\JavaCode\\ssm\\src\\main\\resources\\spring\\applicationContext.xml");
        ((FileSystemXmlApplicationContext) app).start();
      PersonFactoryBean personFactoryBean = (PersonFactoryBean) app.getBean("personFactory");
    }
}
